package com.jsoft.manager;

import com.jsoft.model.MenuDao;
import com.jsoft.model.core.ManagerImpl;

import java.util.List;

/**
 * Date: 14.09.13
 * Time: 9:37
 */

public class MenuManagerImpl extends ManagerImpl<MenuDao> implements MenuManager {
    protected MenuManagerImpl() {
        super(MenuDao.class);
    }

    @Override
    public MenuDao getMenuBySectorId(Integer sectorId) {
        List<MenuDao> list = getEntityManager().createQuery("select m from MenuDao m where m.sector.id = " + sectorId, MenuDao.class).getResultList();
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }
}
